from fastapi import Depends

from app.dos.user_do import userRegisterDo


from app.repositories.user_dao import UserDao
from app.schemas.user_schemas.user_req import UserRegisterReq

from app.schemas.user_schemas.user_resp import UserRegisterResp


class UserService:
    """
    用户服务类
    """

    def __init__(self, ud: UserDao):
        self.user_dao = ud

    async def register(self, user_req: UserRegisterReq):
        """
        用户注册接口
        :param user_req:
        :return:
        """
        user = await self.user_dao.create_user_by_username_password(
            userRegisterDo(**user_req.model_dump())
        )
        return UserRegisterResp(**user.model_dump())





